package db_model

import (
	"time"
)

// VerificationType represents the type of verification
type VerificationType int16

const (
	VerificationTypeRegister VerificationType = 1 // 注册验证
	VerificationTypeForgot   VerificationType = 2 // 忘记密码验证
	VerificationTypeEmail    VerificationType = 3 // 邮箱修改验证
	VerificationTypeMobile   VerificationType = 4 // 手机号修改验证
)

// Verification represents the verification table structure
type Verification struct {
	ID         string           `json:"id" gorm:"type:uuid;primaryKey;default:gen_random_uuid()"`
	Type       VerificationType `json:"type" gorm:"type:smallint;not null;default:1"`
	Identifier string           `json:"identifier" gorm:"type:text;not null"`
	VerifyCode string           `json:"verify_code" gorm:"type:text;not null"`
	ExpiredAt  time.Time        `json:"expired_at" gorm:"type:timestamptz;not null"`
	CreatedAt  time.Time        `json:"created_at" gorm:"type:timestamptz;not null;default:CURRENT_TIMESTAMP"`
}

// TableName specifies the table name
func (Verification) TableName() string {
	return "verification"
}
